Skip to content

Add nginx configuration for WordPress subdirectory setup#426

Merged
kittenkamala merged 3 commits into
WordPress:mainfrom
rollybueno:issue/313
Jan 28, 2026
Merged

Add nginx configuration for WordPress subdirectory setup#426
kittenkamala merged 3 commits into
WordPress:mainfrom
rollybueno:issue/313

Conversation

@rollybueno
Copy link
Copy Markdown
Member

Adds nginx server block configurations to the WordPress subdirectory guide. The current documentation only covers Apache and IIS..

Note:
I only test this configuration in vm but still needs a thorough testing on a real nginx server to ensure accuracy..

#313

Copy link
Copy Markdown

@kittenkamala kittenkamala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Is there a reason to use php 8.1 in here instead of 8.3 (which is WP.org's official recommendation) ?

@rollybueno
Copy link
Copy Markdown
Member Author

I'm using 8.1 on my machine thus I use it there 😅, I'll update that to 8.3

@rollybueno
Copy link
Copy Markdown
Member Author

Hi @kittenkamala - updated the PHP into 8.3 ^^

</IfModule>
```

### nginx (server block)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could link to https://developer.wordpress.org/advanced-administration/server/web-server/nginx/ instead of maintaining multiple copies of this server config?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rollybueno thoughts on this?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should link for more information, but that page is far weedier than this block, so I would vote for keeping it here as a quick reference.

Copy link
Copy Markdown

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm. I think because the Nginx examples called out by @mindctrl are more limited / specific than the linked configuration in the Developer Handbook, it's worth linking out to those pages, but I think having the configuration here makes sense as these code blocks are a lot smaller / simpler / more specific than what's on that page.

Added links out to the Apache / Nginx configuration pages in the note at the top of the guide.

</IfModule>
```

### nginx (server block)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should link for more information, but that page is far weedier than this block, so I would vote for keeping it here as a quick reference.


Many people want WordPress to power their website's root (e.g. https://example.com) but they don't want all of the WordPress files cluttering up their root directory. WordPress allows you to install it into a subdirectory, but have your website served from the website root.

**Note:** This guide covers configuration for Apache (`.htaccess`), nginx (server blocks), and IIS (`web.config`).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Note:** This guide covers configuration for Apache (`.htaccess`), nginx (server blocks), and IIS (`web.config`).
**Note:** This guide covers configuration for Apache (`.htaccess`), nginx (server blocks), and IIS (`web.config`). For more detailed information see the [Apache / `.htaccess` configuration page](https://developer.wordpress.org/advanced-administration/server/web-server/httpd/) or the [Nginx configuration page](https://developer.wordpress.org/advanced-administration/server/web-server/nginx/) in the Developer Handbook.

@kittenkamala kittenkamala merged commit 0da351f into WordPress:main Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants